package com.czy.owner.api;

import android.text.TextUtils;

import com.czy.owner.db.UserHelper;
import com.czy.owner.global.Constants;
import com.czy.owner.net.api.BaseApi;
import com.czy.owner.net.listener.HttpOnNextListener;
import com.trello.rxlifecycle.components.support.RxAppCompatActivity;

import java.util.HashMap;

import retrofit2.Retrofit;
import rx.Observable;

/**
 * Created by asus on 2017/6/5.
 */

public class LuckDrawApi extends BaseApi {
    private String session;


    public LuckDrawApi(HttpOnNextListener listener, RxAppCompatActivity rxAppCompatActivity) {
        super(listener, rxAppCompatActivity);
        setCache(true);
        setShowProgress(true);
        setMothed(UserHelper.getInstance().getUserAccount()+ Constants.OWN_SHOP_GETSHARECONTENT);//相当于缓存保存的Key
        setCookieNetWorkTime(0);//有网缓存0s,在0s内点击无效
        setCookieNoNetWorkTime(0);//无网缓存7天
    }

    public String getSession() {
        return session;
    }


    public void setSession(String session) {
        this.session = session;
    }

    @Override
    public Observable getObservable(Retrofit retrofit) {
        HttpPostService service = retrofit.create(HttpPostService.class);

        return service.getShareContent(getSession());
    }
}
